Skip to content

[model] support minimax_m3#121

Open
Jintao-Huang wants to merge 6 commits into
modelscope:mainfrom
Jintao-Huang:support_minimax_m3
Open

[model] support minimax_m3#121
Jintao-Huang wants to merge 6 commits into
modelscope:mainfrom
Jintao-Huang:support_minimax_m3

Conversation

@Jintao-Huang

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Comment on lines +22 to +25
if not to_mcore:
is_moe = torch.tensor([is_moe], dtype=torch.bool, device='cuda')
if self.pp_size > 1:
dist.all_reduce(is_moe, group=self.pp_group)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using dist.all_reduce directly on a boolean tensor with the default SUM reduction operator will crash when pp_size > 1 because NCCL does not support SUM on boolean tensors. Additionally, evaluating a CUDA tensor directly in an if statement forces an implicit device-to-host synchronization, which can hurt performance. We should use the existing helper method self._reduce_tensor_pp_group(is_moe, to_mcore) which correctly uses ReduceOp.MAX and returns a standard Python boolean.

        is_moe = self._reduce_tensor_pp_group(is_moe, to_mcore)

@modelscope modelscope deleted a comment from gemini-code-assist Bot Jun 16, 2026
@modelscope modelscope deleted a comment from gemini-code-assist Bot Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant